package com.wyz.saas.common

import android.Manifest
import com.wyz.saas.common.utils.JacksonUtils
import java.net.URL

/**
 * 一些不可变的永恒的参数
 * 通常用于一些配置
 */
class Common {
    companion object {
        fun parsing(): String{
            return URL(API_URL).host
        }
        // 手机号的正则,11位手机号
        const val REGEX_MOBILE = "[1][3,4,5,7,8][0-9]{9}$"

        // 基础的网络请求地址
        //var API_URL = "http://192.168.1.11:8080/api/"
        //var API_URL = "http://192.168.0.100:8080/api/"

        //var API_URL = "http://192.168.100.104:8080/Gradle___org_example___im_web_1_0_SNAPSHOT_war/api/"
        //var API_URL = "http://192.168.2.102:8080/Gradle___org_example___im_web_1_0_SNAPSHOT_war/api/"

        const val API_URL = "http://47.111.80.242:8080/im/api/"
        // 最大的上传图片大小860kb
        var MAX_UPLOAD_IMAGE_LENGTH = 860 * 1024.toLong()

        val gson = JacksonUtils.objectMapper()

        val NET_PERMISSION = {
            Manifest.permission.INTERNET
            Manifest.permission.ACCESS_NETWORK_STATE
            Manifest.permission.ACCESS_WIFI_STATE
        }
        val STORAGE_PERMISSION = arrayOf(
            Manifest.permission.READ_EXTERNAL_STORAGE ,
            Manifest.permission.WRITE_EXTERNAL_STORAGE
        )

        val AUDIO_PERMISSION = arrayOf(
            Manifest.permission.RECORD_AUDIO
        )

    }
}